package edu.kjxy.day01;

/**
 * 功能:随机被执行的线程
 * 线程的随机性
 * 作者:程序员欧阳子韩
 * 日期:2024/1/31 13:46
 */
public class RunTest2 {
    public static void main(String[] args) {
        try {
            MyThread2 myThread = new MyThread2();
            myThread.setName("myThread");
            myThread.start();
            for (int i = 0;i < 10;i++) {
                int time = (int) (Math.random() * 1000);
                Thread.sleep(time);
                System.out.println("main=" + Thread.currentThread().getName());
            }
        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }
}
